home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / LostSheep.dxr / 00030_Wolfy Behavior.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  3.1 KB  |  111 lines

  1. property spriteNum, pMyAngle, h, v, pWolfDirection, pWolfSpeed, pLocH, pLocV, pWolfDistance, pWolfRotation, pWait4Step, pEatingSheep, pEatingTime
  2. global gLevel
  3.  
  4. on beginSprite me
  5.   pLocH = sprite(spriteNum).locH
  6.   pLocV = sprite(spriteNum).locV
  7.   pWolfSpeed = 4
  8.   pWolfDirection = 0.0
  9.   pWolfDistance = 0.0
  10.   pWolfRotation = 0.0
  11.   pWait4Step = 0
  12. end
  13.  
  14. on exitFrame me
  15.   if pEatingSheep = 0 then
  16.     pWolfDirection = pWolfDirection - 3.0
  17.     pWolfRotation = 360 - pWolfDirection
  18.     if pWolfDirection <= 0 then
  19.       pWolfDirection = 360
  20.     else
  21.       if pWolfDirection >= 360 then
  22.         pWolfDirection = 0
  23.       end if
  24.     end if
  25.     sprite(spriteNum).rotation = pWolfRotation
  26.     WolfMove()
  27.   else
  28.     if sprite(37).member.name = "deadSheepAnimated2" then
  29.       sprite(37).width = sprite(37).width + 2
  30.       sprite(37).height = sprite(37).height + 2
  31.       if sprite(37).blend >= 2 then
  32.         sprite(37).blend = sprite(37).blend - 2
  33.       end if
  34.     end if
  35.     if sprite(38).member.name = "deadSheepAnimated2" then
  36.       sprite(38).width = sprite(38).width + 2
  37.       sprite(38).height = sprite(38).height + 2
  38.       if sprite(38).blend >= 2 then
  39.         sprite(38).blend = sprite(38).blend - 2
  40.       end if
  41.     end if
  42.     if sprite(39).member.name = "deadSheepAnimated2" then
  43.       sprite(39).width = sprite(39).width + 2
  44.       sprite(39).height = sprite(39).height + 2
  45.       if sprite(39).blend >= 2 then
  46.         sprite(39).blend = sprite(39).blend - 2
  47.       end if
  48.     end if
  49.     if sprite(40).member.name = "deadSheepAnimated2" then
  50.       sprite(40).width = sprite(40).width + 2
  51.       sprite(40).height = sprite(40).height + 2
  52.       if sprite(40).blend >= 2 then
  53.         sprite(40).blend = sprite(40).blend - 2
  54.       end if
  55.     end if
  56.     if pEatingTime < the timer then
  57.       puppetSound(4, "gameoverSound")
  58.       member("endScreenText").text = "Give it another try!"
  59.       go(75)
  60.     end if
  61.   end if
  62. end
  63.  
  64. on WolfMove
  65.   pMyAngle = pWolfDirection * PI / 180.0
  66.   h = sin(pMyAngle) * pWolfSpeed
  67.   v = cos(pMyAngle) * pWolfSpeed
  68.   pLocH = pLocH + h
  69.   pLocV = pLocV + v
  70.   sprite(33).loc = point(pLocH, pLocV)
  71.   sprite(33).rotation = pWolfRotation
  72.   CatchSheep()
  73.   sprite(spriteNum).loc = point(pLocH, pLocV)
  74. end
  75.  
  76. on CatchSheep
  77.   if sprite(33).intersects(32) then
  78.     if sprite(33).intersects(37) then
  79.       sprite(37).member = "deadSheepAnimated2"
  80.       sprite(37).pSheepAlive = 0
  81.       sprite(37).rotation = 0
  82.       pEatingTime = the timer + 180
  83.       pEatingSheep = 1
  84.     end if
  85.     if sprite(33).intersects(38) then
  86.       sprite(38).member = "deadSheepAnimated2"
  87.       sprite(38).pSheepAlive = 0
  88.       sprite(38).rotation = 0
  89.       pEatingTime = the timer + 180
  90.       pEatingSheep = 1
  91.     end if
  92.     if sprite(33).intersects(39) then
  93.       sprite(39).member = "deadSheepAnimated2"
  94.       sprite(39).pSheepAlive = 0
  95.       sprite(39).rotation = 0
  96.       pEatingTime = the timer + 180
  97.       pEatingSheep = 1
  98.     end if
  99.     if sprite(33).intersects(40) then
  100.       sprite(40).member = "deadSheepAnimated2"
  101.       sprite(40).pSheepAlive = 0
  102.       sprite(40).rotation = 0
  103.       pEatingTime = the timer + 180
  104.       pEatingSheep = 1
  105.     end if
  106.   end if
  107. end
  108.  
  109. on WolfSounds
  110. end
  111.